<h1>ClipEvent</h1>

<p>ClipEvent is used to define the actions that a movie clip will execute in 
response to a particular event. ClipEvent are added to an PlaceObject2 instruction
and the actions are registered with the Flash Player when the movie clip is 
added to the display list.</p>

<p>The events that a movie clip responds to are:</p>

<table>
<tr><th align="left">Event</th>
<th align="left">Description</th></tr>
<tr><td nowrap valign="top"><a name="">Load</a></td>
<td>occurs when the movie clip is finished loading.</td></tr>
<tr><td nowrap valign="top"><a name="">Unload</a></td>
<td>occurs when the movie clip is unloaded from the parent movie.</td></tr>
<tr><td nowrap valign="top"><a name="">EnterFrame</a></td>
<td>occurs when each frame in the movie clip is played.</td></tr>
<tr><td nowrap valign="top"><a name="">MouseMove</a></td>
<td>occurs when the mouse pointer is moved.</td></tr>
<tr><td nowrap valign="top"><a name="">MouseDown</a></td>
<td>occurs when the left mouse button is pressed while the cursor is outside of 
the bounding rectangle of the movie clip.</td></tr>
<tr><td nowrap valign="top"><a name="">MouseUp</a></td>
<td>occurs when the left mouse button is pressed  and released while the cursor 
is outside of the bounding rectangle of the movie clip.</td></tr>
<tr><td nowrap valign="top"><a name="">KeyDown</a></td>
<td>occurs when any key is pressed on the keyboard. From Flash 6  a key code can 
be specified to identify a specific key rather than testing for the value inside 
the actions that are executed in response to the event.</td></tr>
<tr><td nowrap valign="top"><a name="">KeyUp</a></td>
<td>occurs when any key being pressed on the keyboard is released.</td></tr>
<tr><td nowrap valign="top"><a name="">Data</a></td>
<td>occurs when an GetUrl2 action is executed with the movie clip specified as 
a target.</td></tr>
</table>

<p>Starting with Flash 6 movie clips also respond to the same set of events that 
buttons do:</p>

<table>
<tr><td nowrap valign="top"><a name="">RollOver</a></td>
<td>occurs when the mouse cursor moves over the movie clip.</td></tr>
<tr><td nowrap valign="top"><a name="">RollOut</a></td>
<td>occurs when the mouse cursor moves out of the bounding rectangle of the 
movie clip.</td></tr>
<tr><td nowrap valign="top"><a name="">Press</a></td>
<td>occurs when the mouse button is clicked while the mouse cursor is inside 
bounding rectangle of the movie clip.</td></tr>
<tr><td nowrap valign="top"><a name="">Release</a></td>
<td>occurs when the mouse button is clicked and released while the mouse cursor 
is inside bounding rectangle of the movie clip.</td></tr>
<tr><td nowrap valign="top"><a name="">ReleaseOut</a></td>
<td>occurs when the mouse button is clicked and the mouse cursor is released 
outside of the bounding rectangle of the movie clip.</td></tr>
<tr><td nowrap valign="top"><a name="">DragOut</a></td>
<td>occurs when the mouse button is clicked and the mouse cursor is dragged out 
of the bounding rectangle of the movie clip.</td></tr>
<tr><td nowrap valign="top"><a name="">DragOver</a></td>
<td>occurs when the mouse button is clicked, the mouse cursor is dragged into 
the bounding rectangle of the movie clip and the mouse button is released.</td></tr>
<tr><td nowrap valign="top"><a name="">Initialize</a></td>
<td>occurs when a movie clip is initialized using the Initialize action.</td></tr>
</td></tr>
</table>

<p>In Flash 7 a new construct event was added.</p>
    
<table>
<tr><td nowrap valign="top"><a name="">Construct</a></td>
<td>The function of this event is undocumented.</td></tr>
</td></tr>
</table>

<p>Movie clips also respond to keys being pressed on the keyboard. Keyboard 
events are defined by the character key being pressed, e.g. "t", "T", "$", etc. 
The ASCII code for the key is used to identify which key was pressed. Note that 
while multiple mouse events can be defined for a button only one keyboard event 
can be defined.</p>

<table>

<tr>
<th nowrap>Field Name</th>
<th>Type</th>
<th>Size</th>
<th>Description</th>
</tr>

<tr>
<td nowrap valign="top">event</td>
<td nowrap valign="top">unsigned bit</td>
<td nowrap valign="top" align="right">16 or 32</td>
<td>A code representing one or more events that the movie clip will respond to.
Flash 5 supported a 16 bit event field while for Flash 6 onwards the event 
model was greatly expanded.</td>
</tr>

<tr>
<td nowrap valign="top">keyCode</td>
<td nowrap valign="top">unsigned int</td>
<td nowrap valign="top" align="right">8</td>
<td>The ASCII code of the key being pressed.</td>
</tr>

<tr>
<td nowrap valign="top">actions</td>
<td nowrap valign="top" colspan="2">Actions[n]</td>
<td>An array of zero or more actions that will be executed when any of the events
defined in the event code occur.</td>
</tr>

</table>

<p>If different actions should be executed then an ClipEvent object is created 
for each different set of events. The PlaceObject2 object that is used to register 
the actions for a movie clip with the Flash Player supports an array of ClipEvents.</p>

<p>The array of actions may be empty. Although this situation does not perform 
any useful operation it is valid and may be encountered when browsing Flash files.</p>

<h2>History</h2>

<p>The ClipEvent class represents the ClipEvent data structure tag from the 
Macromedia Flash (SWF) File Format Specification. It was introduced in Flash 5. 
The event model was extended in Flash 6 to support the set of events that Buttons 
respond to. In Flash 7 the Construct event was added.</p>
